﻿@page "/Bas/Goods/PrintLabel"
@using nERP.ViewModel.Bas.GoodsVMs
@using System.ComponentModel.DataAnnotations
@inherits BasePage


<div id="divMain" align="center" style="margin:0;padding:0px;">
    @if (GoodsList is not null && GoodsList.Count() > 0)
        @foreach (var sp in GoodsList)
        {
            <table cellpadding="0" cellspacing="0" border="1" style="font-size:16px; text-align: center; width: 45mm; height: 30mm; margin: 0; page-break-after: always; padding:0px;">
                <tr>
                    <td>
                        @sp.Goods_GoodsName
                    </td>
                </tr>
                <tr>
                    <td style="height: 78px;padding:8px 8px 8px 46px;">
                        <QRCode Content="@string.Format("{0}", sp.Goods_GoodsCode)" Width="76"></QRCode>
                    </td>
                </tr>
                <tr>
                    <td>
                        @sp.Goods_GoodsCode
                    </td>
                </tr>
            </table>

        }
</div>


@code {
    [Parameter]
    public string id { get; set; }
    [Parameter]
    public string[] ids { get; set; }
    private IEnumerable<nERP.ViewModel.Bas.GoodsVMs.Goods_View> GoodsList { get; set; }

    protected override async Task OnInitializedAsync()
    {
        if (ids.Length > 0)
        {
            var m = await WtmBlazor.Api.CallAPI<IEnumerable<nERP.ViewModel.Bas.GoodsVMs.Goods_View>>
            ($"/api/Bas/Goods/GetPrintListByIds", HttpMethodEnum.POST, ids);
            GoodsList = m.Data;
        }


        await base.OnInitializedAsync();
    }
}
